package com.wc.fortnight_blue_bridge.Q240323.C_求解线性方程组;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/23 20:41
 * @description https://www.lanqiao.cn/problems/17023/learning/?contest_id=177
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010;
    static int[] a = new int[N];
    static int[] x = new int[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        int idx = 0;
        do {
            x[1] = idx++;
            x[2] = a[1] - x[1];
            if (x[2] != 0 && x[2] != 1) continue;
            boolean flg = false;
            for (int i = 3; i < n; i++) {
                x[i] = a[i - 1] - x[i - 2] - x[i - 1];
                if (x[i] != 0 && x[i] != 1) {
                    flg = true;
                    break;
                }
            }
            if (flg) continue;
            x[n] = a[n] - x[n - 1];
            if (x[n] == 0 || x[n] == 1) break;
        } while (true);
//        if (n == 2) x[2] = a[1] - x[1];

        for (int i = 1; i <= n; i++) out.print(x[i] + " ");
        out.flush();
    }


}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}